/**
 * Classe gérant le style de l'interface.
 * 
 * @author Marie-Hélène Goddet, Damien Finck, Cédric Schaller
 * 
 */
package gui;

import javax.swing.JFrame;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;

public class LookAndFeel {
	/**
	 * Utilise le style numéro i pour la frame f
	 * @param f la frame 
	 * @param i le numéro du style à utiliser dans la liste des styles installés
	 */
	public static void setLookAndFeel(JFrame f,int i) {
		UIManager.LookAndFeelInfo[] ui_info = UIManager.getInstalledLookAndFeels();
		String[] ui_tab = new String[ui_info.length];
		for(int j=0; j<ui_info.length;j++) {
			ui_tab[j]=ui_info[j].getClassName();
		}
		if (i>ui_info.length) i=0;
		try {
			if (i==0) UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
			else UIManager.setLookAndFeel(ui_tab[i-1]);
			SwingUtilities.updateComponentTreeUI(f);
			
			//UIManager.put("nimbusBase", new Color(0,0,255));
			//UIManager.put("nimbusBlueGrey", new Color(0,0,255));
			//UIManager.put("control", new Color(0,0,255));
			
			
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		} catch (InstantiationException e) {
			e.printStackTrace();
		} catch (IllegalAccessException e) {
			e.printStackTrace();
		} catch (UnsupportedLookAndFeelException e) {
			e.printStackTrace();
		}
	}
}